class ApplicationController < ActionController::Base
  protect_from_forgery

  def app_login
    if session[:user].nil?
      flash[:warning]='Please login to continue'
      session[:return_to]=request.request_uri
      redirect_to :controller => "home", :action => "login"
    end
  end

  def current_user
    session[:user]
  end

  def redirect_to_stored
    if return_to = session[:return_to]
      session[:return_to]=nil
      redirect_to return_to
    else
      redirect_to '/projects'
    end
  end
end
